package com.iamteer.day23;

import java.io.IOException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;

public class UdpSend {

	public static void main(String[] args) throws IOException {
		udpSend();
	}
	public static void udpSend() throws IOException {
		//1. 建立 UPD 服务
		DatagramSocket socket = new DatagramSocket();
		String data = "hello world...[From Chuck]";
		DatagramPacket packet = new DatagramPacket(data.getBytes(), data.getBytes().length, InetAddress.getLocalHost(), 9090);
		socket.send(packet);
		socket.close();
	}
}
